package site.wetsion.employ.server.service;

import java.math.BigInteger;

import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import site.wetsion.employ.server.mapper.UserMapper;

@Service
public class AdminService {
	
	private final static Logger log = LoggerFactory.getLogger(AdminService.class);

	@Autowired
	private UserMapper userMapper;
	
	/**
	 * 根据用户id获取用户的角色
	 * @param userid
	 * @return
	 */
	public int getRoleByUserId(BigInteger userid){
		try {
			int roleid = userMapper.findRoleByUserId(userid);
			return roleid;
		} catch (Exception e) {
			log.error("数据库查询用户角色失败", e);
			return -1;
		}
	}
}
